//任务，服务器执行
//现在移到了字符串表里，在stringtable.xml
//必须本地执行，因为需要本地化

as_tasks = [];

fnc_addTask = {
	private _title = localize (format ["STR_TAG_T_%1_0", _this]);
	private _info = localize (format ["STR_TAG_T_%1_1", _this]);
	private _task = player createSimpleTask [_title];
	//_task setSimpleTaskDestination (position player);
	_task setSimpleTaskDescription [
		_info,
		_title,
		""
	];
	_task setTaskState "CREATED";
	["TaskAssigned", ["", _title]] call BIS_fnc_showNotification;
	
	as_tasks pushBack _task;
};

fnc_endTask = {
	(as_tasks select _this) setTaskState "SUCCEEDED";
	["TaskSucceeded", ["", localize (format ["STR_TAG_T_%1_0", _this])]] call BIS_fnc_showNotification;
};

0 call fnc_addTask;

sleep 90;

0 call fnc_endTask;
sleep 5;

waitUntil{sleep 1; !isNil "as_gn_num"};

[east, localize "STR_TAG_O_10_0", format[localize "STR_TAG_O_12_1", round(as_gn_num / 2500)]] call fn_talk;
//[east, "联络员",format["据可靠情报，敌占区共有%1个团的编制，请小心行事！", round(as_gn_num / 2500)]] remoteExec["fn_talk", east];

1 call fnc_addTask;

waitUntil{sleep 1; (!isNil "as_e5_find") || (!isNil "as_show_e5")};

1 call fnc_endTask;
sleep 5;

2 call fnc_addTask;

waitUntil{sleep 1; !isNil "as_show_pos"};

2 call fnc_endTask;
sleep 5;

3 call fnc_addTask;
waitUntil{sleep 1; !isNil "as_npc_dead" && {as_npc_dead}};

3 call fnc_endTask;
sleep 5;

waitUntil{sleep 1; !isNil "as_npc_red"};
4 call fnc_addTask;
waitUntil{sleep 1; !isNil "as_defend_state"};


4 call fnc_endTask;
sleep 5;

5 call fnc_addTask;
waitUntil{sleep 1; as_defend_state == 1};

5 call fnc_endTask;
sleep 5;

6 call fnc_addTask;
waitUntil{sleep 1; as_defend_state == 2};

6 call fnc_endTask;
sleep 5;



7 call fnc_addTask;
waitUntil{sleep 1; !isNil "as_in_plane"};

7 call fnc_endTask;
sleep 5;